﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using WindowsFormsApp1.BLL;
using WindowsFormsApp1.Mode;

namespace DataLook.Controllers
{
    public class LameiDateController : Controller
    {
        // GET: LameiDate
        public ActionResult Index()
        { 
			return View();
        }

		[HttpPost]
		public JsonResult GetAgentEmpowerList(BaseSearchPage search)
		{
			ResultObj<EntityPage<Prouduct>> result = new ResultObj<EntityPage<Prouduct>>();
			var jsonResult = new JsonResult();
			jsonResult.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
			if (string.IsNullOrWhiteSpace(search.SearchWord))
			{
				search.orderByWhere = " SaleCount desc ";
			}
			else {
				search.orderByWhere = " "+search.SearchWord+" ";
			}
			EntityPage<Prouduct> list = ProductBLL.GetProuductList(search);
			result.Data =list;
			result.Count = list.Count;
			result.PageCount = list.PageCount;
			return Json(result, JsonRequestBehavior.AllowGet);
		}
	}
}